Skip to content

REF/TST: Add more pytest idiom to mi indexing tests #24040

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed

Conversation

simonjayhawkins
Copy link
Member

@simonjayhawkins simonjayhawkins commented Dec 1, 2018

for this pass:

  • the Test classes have been removed.

  • catch_warnings used for the .ix deprecation replaced with @pytest.mark.filterwarnings("ignore:\\n.ix:DeprecationWarning") at test level.

@pep8speaks
Copy link

Hello @simonjayhawkins! Thanks for submitting the PR.

@codecov
Copy link

codecov bot commented Dec 2, 2018

Codecov Report

Merging #24040 into master will increase coverage by 49.88%.
The diff coverage is n/a.

Impacted file tree graph

@@             Coverage Diff             @@
##           master   #24040       +/-   ##
===========================================
+ Coverage   42.46%   92.35%   +49.88%     
===========================================
  Files         161      161               
  Lines       51557    51557               
===========================================
+ Hits        21892    47613    +25721     
+ Misses      29665     3944    -25721
Flag Coverage Δ
#multiple 90.75% <ø> (?)
#single 42.46% <ø> (ø) ⬆️
Impacted Files Coverage Δ
pandas/core/computation/pytables.py 92.37% <0%> (+0.3%) ⬆️
pandas/io/pytables.py 92.3% <0%> (+0.92%) ⬆️
pandas/util/_test_decorators.py 93.24% <0%> (+4.05%) ⬆️
pandas/compat/__init__.py 58.36% <0%> (+8.17%) ⬆️
pandas/core/config_init.py 99.24% <0%> (+9.84%) ⬆️
pandas/core/reshape/util.py 100% <0%> (+11.53%) ⬆️
pandas/compat/numpy/__init__.py 92.85% <0%> (+14.28%) ⬆️
pandas/core/computation/common.py 85.71% <0%> (+14.28%) ⬆️
pandas/core/api.py 100% <0%> (+14.81%) ⬆️
pandas/core/indexes/api.py 99% <0%> (+14.85%) ⬆️
... and 119 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update b45eb26...c97de72. Read the comment docs.

1 similar comment
@codecov
Copy link

codecov bot commented Dec 2, 2018

Codecov Report

Merging #24040 into master will increase coverage by 49.88%.
The diff coverage is n/a.

Impacted file tree graph

@@             Coverage Diff             @@
##           master   #24040       +/-   ##
===========================================
+ Coverage   42.46%   92.35%   +49.88%     
===========================================
  Files         161      161               
  Lines       51557    51557               
===========================================
+ Hits        21892    47613    +25721     
+ Misses      29665     3944    -25721
Flag Coverage Δ
#multiple 90.75% <ø> (?)
#single 42.46% <ø> (ø) ⬆️
Impacted Files Coverage Δ
pandas/core/computation/pytables.py 92.37% <0%> (+0.3%) ⬆️
pandas/io/pytables.py 92.3% <0%> (+0.92%) ⬆️
pandas/util/_test_decorators.py 93.24% <0%> (+4.05%) ⬆️
pandas/compat/__init__.py 58.36% <0%> (+8.17%) ⬆️
pandas/core/config_init.py 99.24% <0%> (+9.84%) ⬆️
pandas/core/reshape/util.py 100% <0%> (+11.53%) ⬆️
pandas/compat/numpy/__init__.py 92.85% <0%> (+14.28%) ⬆️
pandas/core/computation/common.py 85.71% <0%> (+14.28%) ⬆️
pandas/core/api.py 100% <0%> (+14.81%) ⬆️
pandas/core/indexes/api.py 99% <0%> (+14.85%) ⬆️
... and 119 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update b45eb26...c97de72. Read the comment docs.

@gfyoung gfyoung added Refactor Internal refactoring of code Testing pandas testing functions or related to the test suite MultiIndex labels Dec 2, 2018
Copy link
Member

@gfyoung gfyoung left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is awesome work! However, I have to ask:

Would it be possible to split this PR into multiple PR's? This would make things easier to review.

Also, if you spot opportunities to improve the tests when refactoring, those would be great as well! Improvements include:

  • Breaking up big tests into smaller ones
  • Checking error messages in pytest.raises if meaningful

@simonjayhawkins
Copy link
Member Author

@gfyoung thanks for the review. breaking down the PR is not a problem. would your preference be to split by activity, by file or perhaps limit the number of files in the PR?

import numpy as np
import pytest

from pandas import DataFrame, MultiIndex, Series
from pandas.util import testing as tm


@pytest.mark.filterwarnings("ignore:\\n.ix:DeprecationWarning")
class TestMultiIndexIloc(object):
def test_iloc_getitem_multiindex2():
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we should fix this :>

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

xref #24272

@jreback
Copy link
Contributor

jreback commented Dec 2, 2018

@simonjayhawkins here i think you can split by files. e.g. try to limit the amount that requires review in any 1 PR. Also if you have a PR which simply moves things, those should be independent to making actual changes.

@gfyoung
Copy link
Member

gfyoung commented Dec 2, 2018

here i think you can split by files.

I second @jreback on this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
MultiIndex Refactor Internal refactoring of code Testing pandas testing functions or related to the test suite
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants